-
-
Notifications
You must be signed in to change notification settings - Fork 475
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(cli): execute commands without file paths #2726
feat(cli): execute commands without file paths #2726
Conversation
Co-authored-by: Victorien Elvinger <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome feature! We need to add a test for the ci
command
Args::from([("lint"), ""].as_slice()), | ||
); | ||
|
||
assert!(result.is_ok(), "run_cli returned {result:?}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we forgot to add a snapshot assertion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, this is a test for ok (without lint errors ) case, I'll change this to a test that emits lint errors with snapshot.
Args::from([("check"), ""].as_slice()), | ||
); | ||
|
||
assert!(result.is_ok(), "run_cli returned {result:?}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Forgot the snapshot assertion
Co-authored-by: Emanuele Stoppa <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! This will greatly improve DX :)
| TraversalMode::Lint { .. } | ||
| TraversalMode::Format { .. } | ||
| TraversalMode::CI { .. } => match current_dir() { | ||
Ok(current_dir) => inputs.push(current_dir.into_os_string()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we use the relative path instead of the absolute path here? It seems that our globs don't work well with absolute paths.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we remove the prefix of the current_dir
, I think it would be the relative path. I'll check that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could also improve hyperlinks in the CLI: generally IDE expects relative paths.
Summary
This PR allows
lint
,format
,check
andci
commands to be executed without the file paths argument.e.g.
biome lint .
->biome lint
Closes #2266
Test Plan
biome lint
,biome format
,biome check
by using bin